﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TrainingManagement.api.Models.BusinessLogic.Skill;
using TrainingManagement.api.Models.BusinessObjects;

namespace TrainingManagement.web.Models.ViewModels
{
    public class SkillCreateViewModel
    {
        public int? SkillId { get; set; }

        [Display(Name = "Skill Title")]
        public string Title { get; set; }

        public bool Save()
        {
            SkillId = new SkillCreateOperation().Run(new Skill()
                {
                    Title = this.Title
                }).DocId;
            return SkillId != null;
        }

        public SelectList GetSkill(int? id)
        {
            return new SelectList(new SkillSelectOperation().Run(id), "SkillId", "Title");
        }
    }
}